﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.Data.Schema.Package.Project;

namespace TFDP.VsPackage.Services
{
    public interface IRegenerateObjectService
    {
        void Regenerate(IDatabaseNode node);
    }

    public class RegenerateObjectService : IRegenerateObjectService
    {
        #region IRegenerateObjectService Members

        public void Regenerate(IDatabaseNode node)
        {
            OnRegenerateObject(node);
        }

        #endregion

        public event EventHandler<RegenerateEventArgs> RegenerateObject;

        private void OnRegenerateObject(IDatabaseNode node)
        {
            if (RegenerateObject != null)
            {
                RegenerateObject(this, new RegenerateEventArgs() { Node = node });
            }
        }
    }

    public class RegenerateEventArgs : EventArgs
    {
        public IDatabaseNode Node { get; set; }
    }
}
